package com.example.apiBoss.controller;

import com.example.apiBoss.service.CarService;
import com.example.apiBoss.service.DriverUserService;
import com.example.internalcommon.dto.Car;
import com.example.internalcommon.dto.DriverUser;
import com.example.internalcommon.dto.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author lyra
 * @Date 2023/4/12 15:13
 **/
@RestController

public class DriverUserController {
    @Autowired
    private DriverUserService driverUserService;

    /**
     * 17.添加司机
     * @param driverUser
     * @return
     */
    @PostMapping("/driver-user")
    public ResponseResult addDriverUser(@RequestBody DriverUser driverUser){
        return driverUserService.addDriverUser(driverUser);
    }

    /**
     * 18.修改司机
     * @param driverUser
     * @return
     */
    @PutMapping("/driver-user")
    public ResponseResult updateDriverUser(@RequestBody DriverUser driverUser){
        return driverUserService.updateDriverUser(driverUser);
    }


    @Autowired
    private CarService carService;

    /**
     * 21.apiboss添加车辆信息
     * @param car
     * @return
     */
    @PostMapping("/car")
    public ResponseResult car(@RequestBody Car car){
        return carService.addCar(car);
    }
}
